<!--
 * @Description: 
 * @Version: 1.0
 * @Autor: gaoluo
 * @Date: 2021-08-19 19:42:17
 * @LastEditors: gaoluo
 * @LastEditTime: 2021-12-04 15:13:10
 * @FilePath: /nhw/src/components/Steps/Step/index.vue
-->
<template>
  <div class="step-container">
    <div class="step-wrap">
      <h5 class="time">{{ time }}</h5>
      <div class="wrap">
        <header>{{ headline }}</header>
        <div v-if="showCenter">
          <div class="flex-center" v-for="(item, index) in data" :key="index">
            <div class="info" :class="isEnd ? '' : 'isend'">
              <img :src="'/nhw/' + item.userAvatar" />
              <span
                v-text="
                  isEnd
                    ? `${item.userName}  ${item.handleView}`
                    : `${item.userName} 处理中...`
                "
              ></span>
            </div>
            <div class="time-nodes" v-if="item.stayTimes">
              <Icon name="clock-o" />{{ item.stayTimes }}
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="indicator">
      <div class="step__line"></div>
      <div class="step__circle-container" :class="isEnd ? '' : 'isend'"></div>
    </div>
  </div>
</template>

<script>
import { Icon } from "vant";
export default {
  name: "myStep",
  components: { Icon },
  props: {
    time: {
      type: String,
    },
    headline: {
      type: String,
    },
    showCenter: {
      type: Boolean,
      default: true,
    },
    data: {
      type: Array,
      default: () => [],
    },
    isEnd: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {};
  },

  mounted() {},

  methods: {},
};
</script>

<style lang="less" scoped>
@import "~@/style/var.less";
.step-container {
  position: relative;
  .step-wrap {
    padding: 0 30px 20px 60px;
    .time {
      line-height: 1.8;
      color: @lightWords;
      font-weight: 400;
      font-size: 30px;
    }
    .flex-center {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin: 15px 0;
      .info {
        display: flex;
        align-items: center;
        border-radius: 100px;
        padding: 5px 10px;
        background: #dffeee;
        color: #8acd98;
        &.isend {
          color: #edbd49;
          background: #fef6d3;
        }
        img {
          width: 50px;
          height: 50px;
          border-radius: 50%;
          object-fit: cover;
        }
        span {
          margin-left: 15px;
        }
      }
      .time-nodes {
        .van-icon {
          margin-right: 20px;
        }
        margin-right: 10px;
        display: flex;
        align-items: center;
      }
    }
    .wrap {
      border-radius: 10px;
      background-color: lighten(#ddd, 25%);
      padding: 10px;
      font-size: 26px;
      box-shadow: 1px 0 10px 0 rgba(0, 0, 0, 0.1),
        inset 1px 0 6px 0 rgba(255, 255, 255, 0.7);
      header {
        font-weight: bolder;
        font-size: 1.2em;
        margin-bottom: 12px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
      }
      & > div {
        line-height: 1.7;
      }
    }
  }
  .indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 60px;
    height: 100%;

    .step__circle-container {
      position: absolute;
      top: 15px;
      left: calc(50% - 10px);
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: #6dd7b4;
      box-shadow: 0 0 0 6px #fff, 0 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .step__line {
      width: 2px;
      height: 100%;
      position: absolute;
      top: 15px;
      left: calc(50% - 1px);
      background: #ddd;
    }
  }
  &:first-of-type {
    .step__circle-container {
      background: #5978a2;
    }
  }

  .step__circle-container.isend {
    background: #edbd49 !important;
  }

  &:last-of-type {
    .step__circle-container {
      background: #5978a2;
    }
    .step__line {
      width: 0;
      height: 0;
    }
  }
}
</style>